home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / GRAHAM / XAAES_S.ZIP / XAAES / EVENT_Q.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-01  |  714 b   |  52 lines

  1. /*
  2.  * XaAES - XaAES Ain't the AES
  3.  *
  4.  * A multitasking AES replacement for MiNT
  5.  *
  6.  */
  7.  
  8. #include <memory.h>
  9. #include "EVENT_Q.H"
  10. #include "XA_DEFS.H"
  11. #include "K_DEFS.H"
  12.  
  13. /*
  14.     Event queue support routines
  15. */
  16.  
  17. void EQ_append(EVNT_Q **q, short id, AESPB *pb)
  18. {
  19.     EVNT_Q *n,*c;
  20.     
  21.     c=(EVNT_Q*)malloc(sizeof(EVNT_Q));    /* Create new event queue entry */
  22.  
  23.     if (!c)
  24.         return;
  25.  
  26.     c->next=NULL;
  27.     c->pid=id;
  28.     c->pb=pb;
  29.     
  30.     if (*q==NULL)    /* new list? */
  31.     {
  32.         *q=c;
  33.         return;
  34.     }
  35.     
  36.     for(n=*q; n->next!=NULL; n=n->next);    /* Find end of list */
  37.     
  38.     n->next=c;        /* append entry */
  39. }
  40.  
  41. EVNT_Q *EQ_pull_head(EVNT_Q **q)
  42. {
  43.     EVNT_Q *r;
  44.     
  45.     r=*q;
  46.     
  47.     if (r!=NULL)
  48.         *q=r->next;
  49.     
  50.     return r;
  51. }
  52.